Skip to content

implement jwt authentication#159

Merged
salazarsebas merged 2 commits intoHarmonia-Development:mainfrom
DanielEmmanuel1:feat/jwt-authentication
Oct 2, 2025
Merged

implement jwt authentication#159
salazarsebas merged 2 commits intoHarmonia-Development:mainfrom
DanielEmmanuel1:feat/jwt-authentication

Conversation

@DanielEmmanuel1
Copy link
Contributor

Closes #135

🔧 Key Features Implemented

  • JWT Token Generation: Creates secure tokens with user_id and role claims
  • Token Verification: Validates JWT tokens and extracts user information
  • Route Protection: Middleware protects sensitive endpoints (/kyc/, /wallet/)
  • WebAuthn Integration: Mock WebAuthn verification (ready for real implementation)
  • Comprehensive Testing: Unit tests cover all functionality with mocking
  • Environment Security: JWT_SECRET validation with minimum length requirements
  • Error Handling: Proper HTTP status codes and error messages

🚀 API Endpoints

  • POST /auth/login: Authenticates users and returns JWT tokens
  • Protected Routes: All /kyc/* and /wallet/* routes now require valid JWT tokens

🧪 Testing Coverage

  • JWT token generation and verification
  • Middleware functionality with various scenarios
  • Login endpoint with success and error cases
  • WebAuthn verification mocking
  • Proper error handling and status codes

🔒 Security Features

  • JWT tokens expire in 24 hours
  • Bearer token authentication
  • Environment variable validation
  • Secure token signing with HS256 algorithm
  • Input validation for all endpoints

@DanielEmmanuel1
Copy link
Contributor Author

@salazarsebas All done please review

@salazarsebas
Copy link
Contributor

Hey @DanielEmmanuel1 , please fix the workflow errors

Copy link
Contributor

@salazarsebas salazarsebas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@salazarsebas salazarsebas merged commit c985406 into Harmonia-Development:main Oct 2, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement JWT Authentication for Stellar Wallet Service [wallet -service]

2 participants